#pragma once

#ifndef CALIBRATION_H
#define CALIBRATION_H

#include "vector2d.h"
#include <vector>

using namespace std;

struct latitude
{
  double lt;
  double dist;
};

struct longitude
{
  double lg;
  double angle;
  vector<latitude> lat;
};


class Calibration
{
private:
	bool calib_init_succ;
	bool wise;
	vector2dd cam_center;
	vector<longitude> lglt;
  vector<latitude> lts;

  double dangle;

  void cal_R_h(latitude lat1,latitude lat2,double *R,double *h);
	double cal_lat_ang(double dist, double R, double h);

	void cal_lts(void);
	double cal_longitude(vector2dd coor,int *inx,double *k);
	double cal_latitude(double dist,int inx,double k);

public:
	Calibration(void);
	~Calibration(void);
	vector2dd transform_coor(vector2dd cam);

	bool init_from_file(const char* filename);
	bool init_default(void);

};


#endif